function loadOrderTest() {

    $("#travelList").empty();
    var testTag = null;
    var userid = getCookie("userId");
    $.ajax({
        url : "/DrivingMan/exp/showTestList.do",
        type : "post",
        data : {
            "testTag" : testTag,
            "userid" : userid
        },
        dataType : "json",
        success : function(result) {

            var testList = result.data;
            for ( var i = 0; i < testList.length; i++) {
                var art_id = testList[i].article_id;
                var art_title = testList[i].article_title;
                var user_name = testList[i].user_name;
                var time = testList[i].article_time;
                var t = '<tr><td width="3%"><img src="img/exp.png" /></td>'
                        + '<td width="80%"><a href="Javascript:void(0)" name="' + art_id
                        + '" class="newstitle" onclick="getTestRole(this)">' + art_title + '</a></td>'
                        + '<td width=7%;><span class="author">' + user_name + '</span></td>'
                        + '<td width=10%;><span class="ctime">' + time + '</span></td></tr>';
                $("#travelList").append(t);
            }
        },
    });
}

function driveTestOrderBy(a) {

    $("#travelList").empty();
    $(".first").attr("class", "");
    var $a = $(a);
    $a.parent().attr("class", "first");
    var testTag = $a.text();
    var userid = getCookie("userId");
    $.ajax({
        url : "/DrivingMan/exp/showTestList.do",
        type : "post",
        data : {
            "testTag" : testTag,
            "userid" : userid
        },
        dataType : "json",
        success : function(result) {

            var testList = result.data;
            for ( var i = 0; i < testList.length; i++) {
                var art_id = testList[i].article_id;
                var art_title = testList[i].article_title;
                var user_name = testList[i].user_name;
                var time = testLits[i].article_time;
                var t = '<tr><td width="3%"><img src="img/exp.png" /></td>'
                        + '<td width="80%"><a href="Javascript:void(0)" name="' + art_id
                        + '" class="newstitle" onclick="getTestRole(this)">' + art_title + '</a></td>'
                        + '<td width=7%;><span class="author">' + user_name + '</span></td>'
                        + '<td width=10%;><span class="ctime">' + time + '</span></td></tr>';
                $("#travelList").append(t);
            }
        }
    });
}

function toursubmit() {

    var title = $("#tourtitle").val();
    var role = null;
    if (CKEDITOR.instances.editor1.getData() == "") {
        alert("内容不能为空！");
        return false;
    }
    else {
        role = CKEDITOR.instances.editor1.getData();
    }
    var url = window.location.href;
    var orderid = url.substring(url.indexOf("orderid=") + 8);
    $.ajax({
        url : "/DrivingMan/exp/writeArt.do",
        type : "post",
        data : {
            "title" : title,
            "role" : role,
            "orderid" : orderid
        },
        dataType : "json",
        success : function(result) {

            if (result.status == "0000") {
                alert(result.detail);
                $("#tourtitle").val();
                CKEDITOR.instances.editor1.setData("");
                window.reload();
            }
        }
    });

}

function getTestRole(a) {

    var $a = $(a);
    var artid = $a.attr("name");
    window.open("carExpDetail.html?artid=" + artid + "");
}

function loadTestDetail() {

    var url = window.location.href;
    var artid = url.substring(url.indexOf("artid=") + 6);
    $.ajax({
        url : "/DrivingMan/exp/testDetail.do",
        type : "post",
        data : {
            "artid" : artid
        },
        dataType : "json",
        success : function(result) {

            if (result.status == "0000") {
                var rspMap = result.data;
                $("#arttitle").html('<h3>' + rspMap.article_title + '</h3>');
                $(".authorinfo").html(
                        '<span>' + rspMap.article_time + '</span><span>发表于：</span><span>' + rspMap.user_name
                                + '</span>');
                var tbody = '<table><tr><td>品牌</td><td class="nr">' + rspMap.pinpai + '</td><td>型号</td><td class="nr">'
                        + rspMap.chexingname + '</td></tr>' + '<tr><td>排量</td><td class="nr">' + rspMap.pailiang
                        + 'L</td><td>车型</td><td class="nr">' + rspMap.jibie + '</td></tr>' + '<tr><td>试驾时间</td><td>'
                        + rspMap.order_time + '</td><td>该车售价</td><td>' + rspMap.carprice + '万</td></tr></table>';
                $("#artinfo").html(tbody);
                $("#artdetail").html(rspMap.article_role);
            }
        }
    });
}